﻿(function () {

    var currentInfoDiv = document.getElementById("instruction");

    var showRoomInfo = function (roomId) {
        var infoDiv = document.getElementById(roomId + "-info");
        if (currentInfoDiv) {
            currentInfoDiv.style.display = "none";
        }
        infoDiv.style.display = "block";
        currentInfoDiv = infoDiv;
    };

    var rooms = document.querySelectorAll(".room");
    for (var i = 0; i < rooms.length; i++) {
        var room = rooms[i];
        room.addEventListener("click", function () {
            showRoomInfo(this.id);
        });
    }

} ());
